package com.sdtv.mediunfusion.mvp.presenter;

import com.sdtv.basemodule.mvp.presenter.BasePresenter;
import com.sdtv.basemodule.rx.BaseObserver;
import com.sdtv.mediunfusion.bean.AuditLoggingBean;
import com.sdtv.mediunfusion.mvp.contract.MainContract;
import com.sdtv.mediunfusion.mvp.model.AuditLoggingModel;

import java.util.List;

/**
 * @ProjectName: MediunFusion
 * @Package: com.sdtv.mediunfusion.mvp.presenter
 * @ClassName: AuditLogPresenter
 * @Description: 报题--审核记录
 * @Author: 小郭同学
 * @CreateDate: 2019-08-05 15:28
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class AuditLogPresenter extends BasePresenter<MainContract.AuditLoggingView, AuditLoggingModel> {

    @Override
    public void initRepository() {
        mModel = new AuditLoggingModel(mView);
    }

    /**
     * 获取该报题的审核记录
     *
     * @param topicId
     */
    public void getAuditLoggingList(String topicId) {
        mModel.getAuditLog(topicId).subscribe(new BaseObserver<AuditLoggingBean>(AuditLoggingBean.class) {
            // 获取到报题的审核记录
            @Override
            public void doNextList(int totalCount, List<AuditLoggingBean> resultList) {
                mView.setAuditLogData(resultList);
            }

            // 没有获取到审核记录

            @Override
            public void onEmpty() {
                mView.showEmptyView();
            }

            @Override
            public void onError(Throwable e) {
                mView.showEmptyView();
            }
        });

    }

}
